<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	response.setHeader("Pragma", "no-cache"); 
	response.setHeader("Cache-Control", "no-cache"); 
	response.setDateHeader("Expires", 0); 
%>

<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<link rel="stylesheet" type="text/css" href="/CRRS/css/public.css">
		<title>修改密码</title>
	</head>
	
  <script>
function submitForm(url) 
{ 
	var password = document.getElementById("password").value;
	var password1 = document.getElementById("password1").value;
	var password2 = document.getElementById("password2").value;
	
	var flag = true;
	if(password!=<%=request.getSession().getAttribute("password").toString()%>){
		alert("初始密码不正确！");
		flag = false;
		return false;
	}
	
	if(password1.length<6){
		alert("请至少输入6位新密码");
		flag = false;
		return false;
	}
	
	if(password2.length<6){
		alert("请至少输入6位新密码");
		flag = false;
		return false;
	}
	
	if(password1!=password2){
		alert("两次输入的新密码不一致！");
		flag = false;
		return false;
	}
	
	if(password==password1 && password1==password2){
		alert("新密码和旧密码一致！");
		flag = false;
		return false;
	}
	
	if(flag==true){
		var theform=document.modifyPasswordForm; 
		theform.action=url; 
		theform.method="post";
		theform.submit();
	}
} 
</script>

		<body>
		<table width="100%" height="100%">
		<tr><td height="10%">
		<table width="100%">
<tr><td><jsp:include page="top.jsp" flush="true"></jsp:include></td></tr>
</table>
</td></tr>
<tr><td width="100%" height="80%">
<table width="100%" height="100%">
<tr>
<td>
<table width="100%" height="100%">
<tr><td  style="text-align:center;vertical-align:top; padding-top:40px;">
<form name="modifyPasswordForm">
				<c:if test='${error eq 1 }'>
    			  密码修改成功
    			  <br/>
				</c:if>
<br/>
<label>请输入初始密码：</label><input type="password" name="password"  id="password" value="${orginPassword}">
<br/>
<br/>&nbsp; 
<label>请输入新密码：</label><input type="password" name="password1"  id="password1" value="${password1}">
<br/>
<br/>&nbsp; 
<label>请确认新密码：</label><input type="password" name="password2"  id="password2" value="${password2}">
<br/>
<br/>
<input type="button" class="button" value="提交" onClick="submitForm('system/modifyPassword.do')">
</form>
</td></tr>
<tr><td height="5%" style="text-align: center;vertical-align:top;"> </td></tr>
</table>
</td>
</tr>
</table>
</td></tr>
<tr><td height="10%" style="vertical-align:bottom;">
<table width="100%">
<tr><td><jsp:include page="bottom.jsp"></jsp:include></td></tr>
</table>
</td></tr>
</table>
</body>
</html>
